package com.acegear.horizon.domain.models;

/**
 * Created by wangsike on 2016/12/17.
 */
public abstract class AbstractVerify {
    public Boolean verifyCode(String code) {
        if (getCode().equals(code) &&
                System.currentTimeMillis() < getExpireAt() &&
                getVerifyAt() == 0L) {
            setVerifyAt(System.currentTimeMillis());
            return true;
        } else {
            return false;
        }
    }

    abstract public String getCode();

    abstract public Long getExpireAt();

    abstract public Long getVerifyAt();

    abstract public void setVerifyAt(Long verifyAt);
}
